<layout name="page" />
<block name="js">
	<div id="myModal" class="hidden">
		<div class="popup-frame" >
			<input type="hidden" name="ajax" id="ajax" value="1">
			<div class="popup-header">
				<div class="pull-left">
					<h1>请输入查询密码</h1>
				</div>
				<div class="pull-right">
					<a id="btn_close" class="btn btn-return">关闭</a>
				</div>
			</div>
			<div class="popup-body">
				<div class="popup-body-scroll">
					<div class="popup-content">
						<form id="form_data" name="form_data" method="post" >
							<input type="hidden" name="opmode" id="opmode" value="edit">
							
								<label class="input-label" for="name">查询密码*：</label>
								<div class="input-block col-16">
									<input class="input" type="password" id="password" name="password" check="required" info="请输入名称"  >
								</div>
							</div>
							
								<label class="input-label" for="name"></label>
								
									<a id="btn_save" class="btn" >确定</a>
									<a id="enter" onclick="find_pwd()" type="button" class="link hidden"> 找回密码 </a>
								</div>
							</div>
							
								<label class="input-label" for="name"></label>
								
									如忘记查询密码，请联系管理员初始化
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript">
		layui.use(['global'], function() {
			var $ = layui.jquery;

			$('#myModal').removeClass('hidden');
			var index = layer.open({
				type : 1,
				title : false,
				area : [560 + 'px', 460 + 'px'],
				shade : 0.6,
				closeBtn : 0,
				shadeClose : false,
				scrollbar : false,
				content : $('#myModal')
			});
			if (is_mobile()) {
				layer.full(index);
			}
			
			$("#password").on('keydown',function(e){
				if(e.keyCode==13){
					var vars = $("#form_data").serialize();
					send_ajax("{:url('enter_pwd')}", vars, function(data) {
						if (data.status) {
							window.location = "{:url('index')}&allow=" + data.allow + "";
						} else {
							layer.msg(data.info);
						}
					});
				}				
			});
			//保存后关闭
			$('#btn_save').on('click', function() {
				var vars = $("#form_data").serialize();
				send_ajax("{:url('enter_pwd')}", vars, function(data) {
					if (data.status) {
						window.location = "{:url('index')}&allow=" + data.allow + "";
					} else {
						layer.msg(data.info);
					}
				});
			});

			//关闭iframe
			$('#btn_close').click(function() {
				$('#myModal').addClass('hidden');
				layer.close(index);
			});
		});

		function find_pwd() {
			window.location = "{:url('find_pwd')}";
		}
	</script>
</block>
